﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Entity.Car_Rental;
using Data.Car_Rental;
using Common.Background.Web.Controllers;
namespace Background.Controllers
{
    [ValidateInput(false)]
    public class StaticInfoController : BackgroundBaseController
    {
        IStaticInfoRepository iStaticInfoRepository = null;
        public StaticInfoController()
        {
            iStaticInfoRepository = new StaticInfoRepository();
        }
        //
        // GET: /StaticInfo/

        public ActionResult Index(int? page)
        {
            VP = new Entity.VPredication();
            PP = new Entity.PagingParam(page ?? 1, base.PageSize);
            var model = iStaticInfoRepository.GetStaticInfo(VP, PP);
            return View(model);
        }


        //
        // GET: /StaticInfo/Details/5

        public ActionResult Details(int id)
        {
            return View();
        }

        //
        // GET: /StaticInfo/Create

        public ActionResult Create()
        {
            return View();
        }

        //
        // POST: /StaticInfo/Create

        [HttpPost]
        public ActionResult Create(FormCollection collection)
        {
            StaticInfo entity = new StaticInfo();
            TryUpdateModel(entity);
            if (entity.IsValid)
            {


            }
            else
            {
                entity.GetRuleViolations().ToList().ForEach(i =>
                {
                    ModelState.AddModelError(i.PropertyName, i.ErrorMessage);
                });
            }
            return View();
        }

        //
        // GET: /StaticInfo/Edit/5

        public ActionResult Edit(int id)
        {
            return View();
        }

        //
        // POST: /StaticInfo/Edit/5

        [HttpPost]
        public ActionResult Edit(int id, FormCollection collection)
        {
            try
            {
                // TODO: Add update logic here

                return RedirectToAction("Index");
            }
            catch
            {
                return View();
            }
        }

        //
        // GET: /StaticInfo/Delete/5

        public ActionResult Delete(int id)
        {
            return View();
        }

        //
        // POST: /StaticInfo/Delete/5

        [HttpPost]
        public ActionResult Delete(int id, FormCollection collection)
        {
            try
            {
                // TODO: Add delete logic here

                return RedirectToAction("Index");
            }
            catch
            {
                return View();
            }
        }
    }
}
